package com.itcast.dao;

import com.github.pagehelper.Page;
import com.itcast.pojo.CheckGroup;
import com.itcast.pojo.CheckItem;
import com.itcast.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface CheckgroupDao {
    List<CheckItem> findAll();

    void add(CheckGroup checkGroup);

    void addCheckitemAndCheckgroup(Map map);

    Page<CheckGroup> findPage(String queryString);
    @Select("select * from t_checkgroup where id = #{id}")
    CheckGroup fingById(int id);
    @Select("SELECT t.checkgroup_id FROM health.t_setmeal_checkgroup t where t.setmeal_id= #{setmealId}")
    List<Integer> findByCheckGroupIds(@Param("setmealId") int setmealId);
    @Select("SELECT t.checkitem_id FROM health.t_checkgroup_checkitem t where checkgroup_id= #{id}")
    List<Integer> findByCheckitemIds(int id);
    @Delete("delete from health.t_checkgroup_checkitem where checkgroup_id = #{id}")
    void delCheckItemandCheckgroup(int id);

    void updateCheckgroup(CheckGroup checkGroup);
    @Select("select * from t_checkgroup")
    List<CheckGroup> findCheckgroupAll();

    List<CheckGroup> findByIds(List<Integer> CheckGroupIds);
    @Select("select * from health.t_setmeal_checkgroup where checkgroup_id =#{id}")
    List<Integer> findSetmealIdsById(@Param("id") int id);
}
